﻿using FastUtil.Extra;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FastExecutor.Message.Application
{
    public static class MessageACK
    {
        private static int MessageACKDataBaseNum = 15;
        public static void CopyMessageToACKList(string ChannelName, FastExecutor.Message.Design.Message MessageEntity)
        {
            RedisUtil.SetHash(ChannelName, MessageEntity.MessageHead.MessageID, MessageEntity, MessageACKDataBaseNum);
        }

        public static void ConfirmMessageFinish(string ChannelName, string MessageID)
        {
            RedisUtil.DelteHash(ChannelName, MessageID, MessageACKDataBaseNum);
        }

        public static void MoveMessageToExceptionChannel(string ChannelName, FastExecutor.Message.Design.Message MessageEntity)
        {
            string ExceptionChannelName = ChannelName + "_ExceptionQueue";
            RedisUtil.SetHash(ExceptionChannelName, MessageEntity.MessageHead.MessageID, MessageEntity, MessageACKDataBaseNum);
        }

        public static int GetACKDataBaseNum()
        {
            return MessageACKDataBaseNum;
        }
    }
}
